package com.mall.hadoop.job.sdkclick;
import java.io.IOException;
import org.apache.hadoop.io.IntWritable;
import org.apache.hadoop.io.LongWritable;
import org.apache.hadoop.io.Text;
import org.apache.hadoop.mapreduce.Mapper;
/**
 * @按钮点击统计表
 * @author liugb
 * @date 2016 7 12
 */
public class SdkClickMap extends Mapper<LongWritable, Text, Text, IntWritable>{

	@Override
	protected void map(LongWritable key, Text value, Context context)
			throws IOException, InterruptedException {
		// TODO Auto-generated method stub
		try {
			String line = value.toString();
			String[] split = line.split(",");
			String click_count = split[1];
			String data_type = split[2];
		    context.write(new Text(data_type),new IntWritable(Integer.parseInt(click_count)));	
		} catch (Exception e) {
			// TODO: handle exception
			e.printStackTrace();
		}
		
	}	
}
